package com.yenlien.traceyun.business.trace;


import java.util.List;

/**
 * @author: bigwangy@sina.com
 * @create: 2020-07-23
 * @description:
 **/
public class TraceInfo {

    //步骤
    private String step;

    //上面一级
    private String parentStep;

    //排序
    private int order;


    //信息
    private Object info;

    public TraceInfo(EntityTraceBean bean, Object info) {
        this.step = bean.getStepName();
        this.parentStep = bean.getParentStep();
        this.order = bean.getOrder();
        this.info = info;
    }

    public TraceInfo() {

    }

    private List<TraceInfo> children;

    public String getStep() {
        return step;
    }

    public void setStep(String step) {
        this.step = step;
    }

    public String getParentStep() {
        return parentStep;
    }

    public void setParentStep(String parentStep) {
        this.parentStep = parentStep;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public Object getInfo() {
        return info;
    }

    public void setInfo(Object info) {
        this.info = info;
    }

    public List<TraceInfo> getChildren() {
        return children;
    }

    public void setChildren(List<TraceInfo> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "TraceInfo{" +
                "step='" + step + '\'' +
                ", parentStep='" + parentStep + '\'' +
                ", order=" + order +
                ", info=" + info +
                ", children=" + children +
                '}';
    }

    private String parseObject(Object info) {
        if (info == null) {
            return null;
        }
        if (info instanceof List) {
            StringBuilder stringBuilder = new StringBuilder("[").append(((List) info).size());
            for (Object object : (List) info) {
                stringBuilder.append(object.toString()).append(",");
            }
            stringBuilder.append("]");
            return stringBuilder.toString();
        } else {
            return info.toString();
        }
    }
}
